{include file="public/header" /}
{include file="spec/cope/css" /}
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
    <form action="{:url('save')}" class="layui-form" data-token="{$builderTableToken}" data-nav="{$navTitle}" data-just="{$just}">
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="layui-form-item">
                    <label class="layui-form-label">规格模板名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="title" lay-verify="required" lay-reqtext="请填写规格模板名称"
                               placeholder="请填写规格模板名称" value="{$info?$info.title:''}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品规格</label>
                    <div class="layui-input-block">
                        <div class="spec-box">
                            <i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i>
                            加载中...
                        </div>
                        <div class="add-spec">
                            <div class="layui-inline add-spec-item hide">
                                <label class="layui-form-label w80">规格：</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="spec-title" placeholder="请填写规格" autocomplete="off"
                                           class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline add-spec-item hide">
                                <label class="layui-form-label w80">规格值：</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="spec-val" placeholder="请填写规格值" autocomplete="off"
                                           class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline add-btn-box">
                                <a class="layui-btn layui-btn-normal layui-btn-sm add-spec-btn"
                                   lay-on="add">添加新规格</a>
                                <a class="layui-btn layui-btn-sm add-spec-item hide" lay-on="addOk">确定</a>
                                <a class="layui-btn layui-btn-sm layui-btn-primary add-spec-item hide"
                                   lay-on="clare">取消</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-footer">
                    <a class="layui-btn" lay-filter="saveSpec" lay-submit>
                        保存
                    </a>
                </div>
            </div>
        </div>
    </form>
</div>
</body>
<script type="text/html" id="spec">
    {{#  layui.each(d.spec, function(index, item){ }}
    <div class="spec-item">
        <div class="spec-item-child-title"><span>{{item.title}}</span>
            <i class="layui-icon layui-icon-close close-item" data-id="{{item.id}}"></i>
        </div>
        <div class="spec-content">
            <div class="spec-item-child-lay">
                {{# layui.each(item.child, function(k, c){ }}
                <div class="spec-item-child">
                    <span>{{c.title}}</span> <i class="layui-icon layui-icon-close close-child" data-id="{{c.id}}"></i>
                </div>
                {{# }); }}
                <div class="layui-form-item">
                    <div class="layui-input-inline layui-input-wrap">
                        <input type="text" autocomplete="off" lay-affix="clear"
                               class="layui-input attribute" placeholder="填写属性名">
                    </div>
                    <div class="layui-form-mid add-spec-item-child" data-id="{{item.id}}" style="padding: 0!important;">
                        <button type="button" class="layui-btn layui-btn-sm">添加</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {{#  }); }}
</script>
{include file="public/footer" /}
{include file="spec/cope/js" /}
<script>
    layui.use(['edit'], function () {
        layui.edit.render();
    });
</script>
</html>